package at.ac.univie.ke.neuranetwork;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class ResultPrinter extends Printer{
	private HashMap<String, TestResult> testResults;
	
	private ResultPrinter(){};
	
	public ResultPrinter(HashMap<String, TestResult> testResults){
		setTestResults(testResults);
	}
	
	public void showOutcome(){
	   Iterator it = getTestResults().entrySet().iterator();
	    while (it.hasNext()) {
	        Map.Entry pairs = (Map.Entry)it.next();
	        
	        TestResult testResult = (TestResult) pairs.getValue();
	        
	        drawLine();
	        System.out.println(pairs.getKey());
	        System.out.println("Network: " + testResult.getNetwork() );
	        System.out.println("learningRate: " + testResult.getLearningRate() );
	        System.out.println("totalNetworkError: " + testResult.getTotalNetworkError() );
	        System.out.println("meanDistance: " + testResult.getMeanDistance() );
	        drawLine();
	        drawSpace();
	        
	        it.remove(); // avoids a ConcurrentModificationException
	    }
	}
	
	public HashMap<String, TestResult> getTestResults() {
		return testResults;
	}
	public void setTestResults(HashMap<String, TestResult> testResults) {
		this.testResults = testResults;
	}
}
